﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DataDemo.aspx.cs" Inherits="ExamAnalysis.DataDemo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>标准的数据库读取方法</h3>
        <p>第一种方式是LinqDataSrouce</p>
        <asp:GridView ID="Demo1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="LinqDataSource1" >
            <Columns>
                <asp:BoundField DataField="ClassName" HeaderText="ClassName" ReadOnly="True" 
                    SortExpression="ClassName" />
                <asp:BoundField DataField="ClassCode" HeaderText="ClassCode" ReadOnly="True" 
                    SortExpression="ClassCode" />
                <asp:BoundField DataField="EnrollYear" HeaderText="EnrollYear" ReadOnly="True" 
                    SortExpression="EnrollYear" />
            </Columns>
        </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
            ContextTypeName="ExamAnalysis.Model.ExamAnalysisDataContext" EntityTypeName="" 
            OrderBy="EnrollYear desc" Select="new (ClassName, ClassCode, EnrollYear)" 
            TableName="ClassInfo">
        </asp:LinqDataSource>
        <p>第二种方式是DataSource=XX,DataSource.DataBind()</p>
        <asp:GridView ID="Demo2" runat="server">
            <Columns>
                <asp:BoundField DataField="ClassName" HeaderText="ClassName" ReadOnly="True" 
                    SortExpression="ClassName" />
                <asp:BoundField DataField="ClassCode" HeaderText="ClassCode" ReadOnly="True" 
                    SortExpression="ClassCode" />
                <asp:BoundField DataField="EnrollYear" HeaderText="EnrollYear" ReadOnly="True" 
                    SortExpression="EnrollYear" />
            </Columns>
        </asp:GridView>
        <p>第三种方式即在EXT.NET中使用，参考http://exampls.ext.net/,之前做的demo，
            <a href="Manage/ClassInfo.aspx">这里</a>
        </p>
    </div>
    </form>
</body>
</html>
